package cn.jbit.entity;

import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Arrays;
import java.util.Collection;

/**
 * 源码学院只为培养优秀的bat程序员而生
 *
 * @author 学员张在成
 * @data 2021/6/13
 */
@Data
public class User implements UserDetails {

    private  Integer  id; //用户id

    private  String  username; //用户账户

    private  String  password; //用户密码

    private  String  phone; //手机号

    private Integer isVip;//是否vip

    private  Integer  isOpen;//是否开通会员

    private  String  userPicture; //图片

    private  Integer  level; //会员等级

    private  String token; //用户token


    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return Arrays.asList(new SimpleGrantedAuthority("TEST"));
    }

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }
}
